With the application of an NAND flash and the emergence of a new storage medium, such as a Phase change memory (PCM), different mediums have different read and write characteristics. This requires a file system to use management methods of different granularities to manage files stored in storage mediums, so as to improve performance. For example, if a coarse granularity is used for management, a storage overhead of metadata and a time delay of searching for a metadata index can be reduced; if a fine granularity is used for management, valid access to data can be ensured, bandwidth is not wasted, and data migration is reduced.
In the prior art, a file system identifies a file type according to a file name or information embedded in a file, and allocates a storage medium of a different granularity to the file. After the file type is determined, a management mode of the file is also determined, which is relatively fixed.